<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">

    <title></title>
    <script type="text/javascript">
        $(function(){
            $.session.remove("is_login");

        });
        function login_open(){
            layer.open({
                title:['登录图书账号','height: 50px;line-height: 50px;background: #F7F7F7;color:#777777;font-weight: bolder;font-size:18px;'],
                type:1,
                area:['470px','350px'],
                content:$("#login_open")
            });
        }

        function login_open_admin(){
            layer.open({
                title:['管理员账号登录','height: 50px;line-height: 50px;background: #F7F7F7;color:#777777;font-weight: bolder;font-size:18px;'],
                type:1,
                area:['450px','300px'],
                content:$("#login_open_admin")
            });
        }

        function login_open_login(){
            var name = $("#txt_name").val();
            var pw = $("#txt_pw").val();
            if(name == ""){
                layer.alert("用户名不能为空!",
                    {
                        title:"提示",
                        icon:5
                    });
                return;
            }
            if(pw == ""){
                layer.alert("密码不能为空!",
                    {
                        title:"提示",
                        icon:5
                    });
                return;
            }
            var wait = layer.load(3);
            $.post("layerLogin",
                {
                    "user.loginName":name,
                    "user.loginPassword":pw
                },function(data){

                    layer.close(wait);
                    if(data == "OK"){
                        location.href="index";
                    }else if(data == "ERROR_USER"){
                        layer.alert("用户名或密码错误!",
                            {
                                title:"提示",
                                icon:5
                            });
                    }else{
                        layer.alert("未知错误!",
                            {
                                title:"提示",
                                icon:5
                            });
                    }

                });
        }
        function login_open_login_admin(){
            var name = $("#txt_name_admin").val();
            var pw = $("#txt_pw_admin").val();
            if(name == ""){
                layer.alert("用户名不能为空!",
                    {
                        title:"提示",
                        icon:5
                    });
                return;
            }
            if(pw == ""){
                layer.alert("密码不能为空!",
                    {
                        title:"提示",
                        icon:5
                    });
                return;
            }
            var wait = layer.load(3);
            $.post("admin/layerLogin",
                {
                    "admin.loginName":name,
                    "admin.loginPassword":pw
                },function(data){

                    layer.close(wait);
                    if(data == "OK"){
                        location.href="admin/index";
                    }else if(data == "ERROR_USER"){
                        layer.alert("用户名或密码错误!",
                            {
                                title:"提示",
                                icon:5
                            });
                    }else{
                        layer.alert("未知错误!",
                            {
                                title:"提示",
                                icon:5
                            });
                    }

                });
        }
    </script>
</head>
<body>

<nav class="navbar navbar-inverse ">
    <div class="nav navbar-header">
        <img alt="" src="image/78.jpg" width="100px" height="50px"/>
        图书租赁系统
    </div>
    <ul class="nav navbar-nav">
        <li><a href="index">首页</a></li>
        <li><a href="user/add_user.jsp">用户注册</a></li>
        <li><a href="javaScript:" onclick="login_open()">用户登录</a></li>
        <li><a href="javaScript:" onclick="login_open_admin()">管理员登录</a></li>

    </ul>
    <div class="container">
        <div class="nav navbar-nav navbar-right">
            <li><a href="javaScript:" class="btn btn-primary "  id="btn_open">关于我们</a></li>
        </ul>
    </div>


</nav>

<div id="header_navigation">



    <div id="login_open">
        
            <form role="form" class="form-horizontal" style="margin-left:10px;">

                <h3 class="text-center">用户登录界面</h3>
                <div class="form-group">
                    <label class="col-lg-2" for="txt_name">用户名</label>
                    <div class="col-lg-10"><input type="text" id="txt_name" placeholder="请输入用户名" class="form-control"></div>
                </div>
                <div class="form-group">
                    <label class="col-lg-2" for="txt_pw">密码</label>
                    <div class="col-lg-10"><input type="password" id="txt_pw" placeholder="请输入密码" class="form-control"></div>
                </div>
                <button type="button" class="btn btn-block btn-success" style="margin-top: 30px;" onclick="return login_open_login()">登录</button>
                <div id="login_open_form_new_user"><a href="user/add_user.jsp">立即注册</a></div>

            </form>

    </div>

    <div id="login_open_admin">
	<form role="form" class="form-horizontal" style="margin-left:10px;">

                <h3 class="text-center">管理登录界面</h3>
                <div class="form-group">
                    <label class="col-lg-3" for="txt_name_admin">管理员名</label>
                    <div class="col-lg-9"><input type="text" id="txt_name_admin" placeholder="请输入用户名" class="form-control"></div>
                </div>
                <div class="form-group">
                    <label class="col-lg-3" for="txt_pw_admin">密码</label>
                    <div class="col-lg-9"><input type="password" id="txt_pw_admin" placeholder="请输入密码" class="form-control"></div>
                </div>
                <button type="button" class="btn btn-block btn-success" style="margin-top: 30px;" onclick="return login_open_login_admin()">登录</button>
               

            </form>
        </div>
    </div>
</div>

<div class="modal" role="dialog" id="myModal">


        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h3 class="modal-title">
                        小组成员
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </h3>
                </div>
                <div class="modal-body">
                    <ul class="nav nav-pills nav-stacked text-center bg-success text-primary">
                        <li><a><h3>罗强强</h3></a></li>
                        <li><a><h3>褚泽涛</h3></a></li>
                        <li><a><h3>宣萌</h3></a></li>
                        <li><a><h3>胡丙志</h3></a></li>
                        <li><a><h3>张宗艳</h3></a></li>
                    </ul>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>

        </div>

    </div>

</body>

<script>
    $(function () {

        $("#btn_open").click(function () {
            $("#myModal").modal({
                backdrop: "static"     //点击空白不消失
            });
        });
    })
</script>

</html>